package com.manage.project.biz.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.project.biz.domain.BizTongfeng;
import com.manage.project.biz.service.IBizTongfengService;
import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.web.page.TableDataInfo;

/**
 * 通风设施Controller
 * 
 * @author liang
 * @date 2022-06-01
 */
@RestController
@RequestMapping("/biz/tongfeng")
public class BizTongfengController extends BaseController
{
    @Autowired
    private IBizTongfengService bizTongfengService;

    /**
     * 查询通风设施列表
     */
    @PreAuthorize("@ss.hasPermi('biz:tongfeng:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizTongfeng bizTongfeng)
    {
        startPage();
        List<BizTongfeng> list = bizTongfengService.selectBizTongfengList(bizTongfeng);
        return getDataTable(list);
    }

    /**
     * 导出通风设施列表
     */
    @PreAuthorize("@ss.hasPermi('biz:tongfeng:export')")
    @Log(title = "通风设施", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BizTongfeng bizTongfeng)
    {
        List<BizTongfeng> list = bizTongfengService.selectBizTongfengList(bizTongfeng);
        ExcelUtil<BizTongfeng> util = new ExcelUtil<BizTongfeng>(BizTongfeng.class);
        return util.exportExcel(list, "通风设施数据");
    }

    /**
     * 获取通风设施详细信息
     */
    @PreAuthorize("@ss.hasPermi('biz:tongfeng:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizTongfengService.selectBizTongfengById(id));
    }

    /**
     * 新增通风设施
     */
    @PreAuthorize("@ss.hasPermi('biz:tongfeng:add')")
    @Log(title = "通风设施", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizTongfeng bizTongfeng)
    {
        return toAjax(bizTongfengService.insertBizTongfeng(bizTongfeng));
    }

    /**
     * 修改通风设施
     */
    @PreAuthorize("@ss.hasPermi('biz:tongfeng:edit')")
    @Log(title = "通风设施", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizTongfeng bizTongfeng)
    {
        return toAjax(bizTongfengService.updateBizTongfeng(bizTongfeng));
    }

    /**
     * 删除通风设施
     */
    @PreAuthorize("@ss.hasPermi('biz:tongfeng:remove')")
    @Log(title = "通风设施", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizTongfengService.deleteBizTongfengByIds(ids));
    }
}
